﻿using System;
using System.Collections.Generic;

using RexToy;
using RexToy.Text;

namespace ScriptXCompiler
{
    public enum IssueType
    {
        Warning,
        Error
    }

    public class CompileIssue
    {
        private string _desc;
        private string _msg;
        public string Message
        {
            get { return _msg; }
        }

        public CompileIssue(IssueType type, IssueId id)
        {
            this._id = id;
            this._issueType = type;
            _desc = id.GetDescription();
            _msg = _desc;
        }

        public CompileIssue(IssueType type, IssueId id, params object[] args)
            : this(type, id)
        {
            _msg = _desc.TryFormat(args);
        }

        private IssueType _issueType;
        public IssueType IssueType
        {
            get { return _issueType; }
        }

        private IssueId _id;
        public int IssueId
        {
            get { return (int)_id; }
        }

        private object _syntaxItem;
        public object SyntaxItem
        {
            get { return _syntaxItem; }
            internal set { _syntaxItem = value; }
        }
    }
}
